package cn.hf.mychat.common.poi;

import java.lang.reflect.Field;
import java.util.Comparator;

/**
 * @author 白高建
 * @create 2020/1/20 15:08
 */
public class ExcelColumnCompare implements Comparator<Field> {
    public int compare(Field o1, Field o2) {
        ExcelColumn a1 = o1.getAnnotation(ExcelColumn.class);
        ExcelColumn a2 = o2.getAnnotation(ExcelColumn.class);
        if (null != a1 && null != a2) {
            return Integer.compare(a1.order(), a2.order());
        } else {
            return 0;
        }
    }
}
